﻿module FeaturesTests


open System
open System.IO
open Microsoft.VisualStudio.TestTools.UnitTesting
open Streams
open Sources
open Features


[<TestClass>]
type FeaturesTests() = 

   [<TestMethod>]
   member public self.ReadFeatureHeader_ReadsValidWithProperInput() =
      use stream = CreateStream("Feature: this is a feature \r\n\r\n")
      use reader = CreateReader(stream)
      
      let actual = ReadFeatureHeader(reader).Value

      Assert.AreEqual("Feature:", actual.Keyword.Source)
      Assert.AreEqual("this is a feature ", actual.Description.Source)


   [<TestMethod>]
   member public self.ReadFeatureHeader_ReadsInvalidWithInvalidInput() =
      use stream = CreateStream("Scenario: this is a scenario \r\n\r\n")
      use reader = CreateReader(stream)
      
      let actual = ReadFeatureHeader(reader)

      Assert.IsTrue(actual.IsNone)
      